/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ModelLayer;
/**
 *
 * @author Martin
 */
public class PartOrder {
    private int partOrderId;
    private double amount;
    private String depth;
    private double actualAmount;
    private Machine machine;
    private Employee employee;
    private ProductDescription proDesc;

    public PartOrder(int partOrderId, double amount, String depth, double actualAmount, Machine machine, Employee employee, ProductDescription proDesc) {
        this.partOrderId = partOrderId;
        this.amount = amount;
        this.depth = depth;
        this.actualAmount = actualAmount;
        this.machine = machine;
        this.employee = employee;
        this.proDesc = proDesc;
    }

    public PartOrder()
    {
        
    }
    
   /**
     * @return the partOrderId
     */
    public int getPartOrderId() {
        return partOrderId;
    }

    /**
     * @param partOrderId the partOrderId to set
     */
    public void setPartOrderId(int partOrderId) {
        this.partOrderId = partOrderId;
    }
    
    /**
     * @return the amount
     */
    public double getAmount() {
        return amount;
    }

    /**
     * @param amount the amount to set
     */
    public void setAmount(double amount) {
        this.amount = amount;
    }

    /**
     * @return the depth
     */
    public String getDepth() {
        return depth;
    }

    /**
     * @param depth the depth to set
     */
    public void setDepth(String depth) {
        this.depth = depth;
    }
    
    /**
     * @return the actualAmount
     */
    public double getActualAmount() {
        return actualAmount;
    }

    /**
     * @param actualAmount the actualAmount to set
     */
    public void setActualAmount(double actualAmount) {
        this.actualAmount = actualAmount;
    }

    /**
     * @return the machine
     */
    public Machine getMachine() {
        return machine;
    }

    /**
     * @param machine the machine to set
     */
    public void setMachine(Machine machine) {
        this.machine = machine;
    }

    /**
     * @return the employee
     */
    public Employee getEmployee() {
        return employee;
    }

    /**
     * @param employee the employee to set
     */
    public void setEmployee(Employee employee) {
        this.employee = employee;
    }

    /**
     * @return the proDesc
     */
    public ProductDescription getProDesc() {
        return proDesc;
    }

    /**
     * @param proDesc the proDesc to set
     */
    public void setProDesc(ProductDescription proDesc) {
        this.proDesc = proDesc;
    }
     
    public double calculateNettoSubTotal()
    {
        double subTotal = 0;
        
        if(getEmployee() != null)
        {
            subTotal = (amount * getEmployee().getInternalHourlyWage());
        }
        if(getMachine() != null)
        {
            subTotal = (amount * getMachine().getHourPrice());
        }
        if(getProDesc() != null)
        {
            subTotal = (amount * getProDesc().getPurchasePrice());
        }
        return subTotal;
    }
    
    public double calculateBruttoSubTotal()
    {
        double subTotal = 0;
        System.out.println("emp " + getEmployee().getInternalHourlyWage());
        
        if(getEmployee() != null)
        {
            subTotal = (amount * getEmployee().getExternalHourlyWage());
        }
        if(getMachine() != null)
        {
            subTotal = (amount * getMachine().getHourPrice());
        }
        if(getProDesc() != null)
        {
            subTotal = (amount * getProDesc().getSalesPrice());
        }
        System.out.println("subtotal " + subTotal);
        return subTotal;
    }
    
    public double calculateDifference()
    {
        return calculateBruttoSubTotal() - calculateNettoSubTotal();
    }
}
